package com.lgy.common;

import javax.servlet.http.HttpServletRequest;

public class SessionUtils {
    public static final String SESSION_USER = "session_user";

    /**
     * 设置session的值
     * @param request
     * @param key
     * @param value
     */
    public static void setAttr(HttpServletRequest request, String key, Object value){
        request.getSession(true).setAttribute(key, value);
    }


    /**
     * 获取session的值
     * @param request
     * @param key
     */
    public static Object getAttr(HttpServletRequest request,String key){
        return request.getSession(true).getAttribute(key);
    }

    /**
     * 删除Session值
     * @param request
     * @param key
     */
    public static void removeAttr(HttpServletRequest request,String key){
        request.getSession(true).removeAttribute(key);
    }
}
